// 手机号校验
function checkPhone (phone) {
	return (/^1[3456789]\d{9}$/.test(phone))
} 

// 过滤城市
function filterCity(city ,e){  
	let cityInfo =  {  
		// 省
		province_id:'',
		// 市
		city_id: '',
		// 区
		area_id: '',
	}
	city.forEach((item, index) => { 
		if (item.label == e.province.label) {   
			cityInfo.province_id = item.value 
			item.children.forEach((item1, index1) => { 
				if (item1.label == e.city.label) { 
					cityInfo.city_id = item1.value
					item1.children.forEach((item2, index2) => {
						if (item2.label == e.area.label) {
							cityInfo.area_id = item2.value 
						}
					})
				}
			})
		}
	})
	return cityInfo
}

// 获取当前时间
function getTime(){
 let date = new Date(),
 year = date.getFullYear(),
 month = date.getMonth() + 1,
 day = date.getDate(),
 hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
 minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
 second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
 month >= 1 && month <= 9 ? (month = "0" + month) : "";
 day >= 0 && day <= 9 ? (day = "0" + day) : "";
 return year + '.' + month + '.' + day
 
}
export {checkPhone,filterCity,getTime}